package com.example.controller;

import java.util.stream.IntStream;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author changwei
 * @date 2019年10月17日
 */
@RestController
@RequestMapping("/test")
public class TestController {

	@RequestMapping(value="/getString",method=RequestMethod.GET)
	public String getString(String str) {
		
		if("2".equals(str)) {
			StringBuffer sb = new StringBuffer("abc");
			IntStream.range(1, 10000).forEach(a -> {
				sb.append(a).append("abc");
			});
			System.out.println("sb length:"+sb.length());
			str = sb.toString();
		} else if("3".equals(str)) {
			throw new RuntimeException("我处理失败了");
		}
		return str;
	}
	
}
